package com.thtfpc.utility;

public class ThreadUtil {
    public static boolean join(Thread t) throws Exception{
        if(Thread.currentThread() == t) {
            System.out.println("thread can not join self:" + Thread.currentThread().getName());
            throw new Exception("thread can not join self.");
        }
        try {
            t.join();
            return false;
        }
        catch (InterruptedException ex) {
        }
        return true;
    }

    public static boolean sleep(int milliSeconds) {
        try {
            Thread.sleep(milliSeconds);
            return false;
        }
        catch (InterruptedException ex) {
            return true;
        }
    }
}
